import java.util.HashMap;
import java.util.Scanner;
import java.util.concurrent.SynchronousQueue;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/1/13
 * \* Time: 14:59
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class TestDemo {
    public static void main(String[] args) {

        int []arr={3,2,2,2,3};
        Scanner scanner=new Scanner(System.in);
        scanner.hasNext();
    }

    public int removeElement(int[] nums, int val) {
        int j=1;
        for(int i=0;i<nums.length;i++){
            if(nums[i]==val){
                nums[i]=nums[j];
                j++;
            }
            j++;
        }
        return j;
    }

    public <HasMap> int romanToInt(String s) {
        int ans=0;
        char[] ch=s.toCharArray();
        HashMap<Character,Integer> map=new HashMap<>();
        map.put('I',1);
        map.put('V',5);
        map.put('X',10);
        map.put('L',50);
        map.put('C',100);
        map.put('D',500);
        map.put('M',1000);
        for (int i=0;i<ch.length;i++){
            if(i<ch.length-1&&map.get(ch[i])<map.get(ch[i+1])) {
                ans -= map.get(ch[i]);
            }else {
                ans+=map.get(ch[i]);
            }
        }
        return ans;
    }
}
